//
// Created by Semir on 2020/4/3.
//

#include <iostream>

using namespace std;

const int MAX_LEN = 1010;
int s;
int value[MAX_LEN];
int dp[MAX_LEN][MAX_LEN];

int main() {
    cin >> s;
    for (int i = 1; i <= s; i++) {
        for (int j = 1; j < i; j++) {
            if (i % j == 0) {
                value[i] += j;
            }
        }
    }
    for (int i = 0; i <= s; i++) {
        dp[0][i] = 0;
    }
    for (int i = 1; i <= s; i++) {
        for (int j = 0; j < i; j++) {
            dp[i][j] = dp[i - 1][j];
        }
        for (int j = i; j <= s; j++) {
            dp[i][j] = max(value[i] + dp[i - 1][j - i], dp[i - 1][j]);
        }
    }
    cout << dp[s][s] << endl;
    return 0;
}
